package com.bwie.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.mapper.UserTripOrderMapper;
import com.bwie.pojo.UserTripOrder;
import com.bwie.service.UserTripOrderService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liuxin
 * @since 2025-03-23
 */
@Service
public class UserTripOrderServiceImpl extends ServiceImpl<UserTripOrderMapper, UserTripOrder> implements UserTripOrderService {

    /**
     * 获取所有订单
     * @return
     */
    public List<UserTripOrder> getFilteredUserTripOrders() {
        // 假设这里从数据库获取所有UserTripOrder数据
        List<UserTripOrder> userTripOrders = this.list();

        // 使用Stream流和Lambda表达式进行处理
        List<UserTripOrder> filteredOrders = userTripOrders.stream()
                .map(order -> {
                    // 可以在这里对每个订单进行一些操作，例如设置某些字段
                    order.setIsDelete(0); // 设置逻辑删除字段为0
                    return order;
                })
                .collect(Collectors.toList());

        return filteredOrders;
    }
}
